package com.kasinf.springcloud.alibaba.controller;

import com.kasinf.springcloud.alibaba.domain.Account;
import com.kasinf.springcloud.alibaba.service.AccountService;
import com.kasinf.springcloud.entity.CommonResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;

/**
 * @author KAISER
 */
@RestController
@RequestMapping("account")
public class AccountController {

    @Resource
    private AccountService accountService;

    @RequestMapping("decrease")
    public CommonResult<Account> decrease(@RequestParam("userId") Long userId, @RequestParam("money")BigDecimal money){
        accountService.decrease(userId, money);
        return new CommonResult<>(200, "扣减账户余额成！");
    }
}
